test: fix vacuous assertions in src/fuzzy_schedule.rs#1512
Merged
jamesadevine merged 1 commit intoJul 15, 2026
Conversation
Rewrite two low-value tests that only checked enum discriminants via matches! without verifying the cron expressions they generate: - test_parse_hourly: add cron structure assertions (5 fields, scattered minute in [0,59], correct * wildcards for hourly) - test_parse_special_periods: add cron step assertions (*/14 for bi-weekly, */21 for tri-weekly) plus bounds checks on the scattered minute/hour values Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test Suite Reduction:
src/fuzzy_schedule.rsWhat was wrong
test_parse_hourly: body was a singlematches!check on a unit enum variant. It confirmed the keyword"hourly"parses toFuzzySchedule::Hourly, but made no assertion about the cron expression that variant produces. A regression that changed the cron format (e.g. replacing the scattered minute with a fixed0, or adding an extra field) would pass undetected.test_parse_special_periods: same pattern — twomatches!checks confirmed"bi-weekly"and"tri-weekly"parse to their respective variants, but never verified the cron step values (*/14/*/21) or the scattered minute/hour bounds. Swapping the two steps, or emitting a fixed0instead of a hash-scattered value, would not be caught.Changes
test_parse_hourly* * * *wildcard assertionstest_parse_special_periods*/14/*/21step assertions and scattered minute/hour range checks for both variantsVerification
cargo test -- fuzzy_schedule: all 18 tests pass ✅